package chapterSystem.client.callbacks;

import chapterSystem.client.interfaceDrawing.activities.Activity;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.StackLayoutPanel;

public class WriteSimpleEntityCallback implements AsyncCallback<String> {
    final private StackLayoutPanel workArea;
    final private Activity callback;

    public WriteSimpleEntityCallback(StackLayoutPanel workArea, Activity callback) {
        this.workArea = workArea;
        this.callback = callback;
    }

    @Override
    public void onFailure(Throwable caught) {
        Window.alert(caught.getMessage());
        callback.drawActivity(workArea);
    }

    @Override
    public void onSuccess(String result) {
        Window.alert(result);
        callback.drawActivity(workArea);
    }
}
